package org.yjc.service;

import java.util.List;
import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.yjc.entity.KingRoot;
import org.yjc.entity.LesseeAdmin;
import org.yjc.entity.SysUser;
import org.yjc.repository.LesseeAdminRepository;

@Service
public class LesseeAdminService {
	@Autowired
	private LesseeAdminRepository lesseeadminDAO;

	public List<LesseeAdmin> findAll() {
		return lesseeadminDAO.findAll();
	}

	public Page<LesseeAdmin> findAll(Pageable pageable) {
		return lesseeadminDAO.findAll(pageable);
	}

	public Page<LesseeAdmin> findAll(Specification spec, Pageable pageable) {
		return lesseeadminDAO.findAll(spec, pageable);
	}

	public void deleteById(int parseInt) {
		lesseeadminDAO.deleteById(parseInt);
	}

	public void save(LesseeAdmin lesseeadmin) {
		lesseeadminDAO.save(lesseeadmin);
	}

	public LesseeAdmin findById(Integer id) {
		Optional<LesseeAdmin> optional = lesseeadminDAO.findById(id);
		if(optional.isPresent()) {
			return optional.get();
		}
		return null;
	}

	public SysUser findByUsername(String username) {
		return lesseeadminDAO.findByUsername(username);
	}

/*	public LesseeAdmin findById(Pageable pageable, Integer lesseeadminId) {
		Optional<LesseeAdmin> optional = lesseeadminDAO.findById(lesseeadminId);
		if(optional.isPresent()) {
			return optional.get();
		}
		return null;
	}*/
	
}
